package cn.fenqing168.springcloud.controller;

import cn.fenqing168.springcloud.commons.BaseResult;
import cn.fenqing168.springcloud.service.IStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Vector;
import java.util.stream.Collectors;


/**
 * @author fenqing
 */
@RestController
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    private IStorageService iStorageService;

    @PostMapping("/decrease")
    public BaseResult<?> decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count){
        iStorageService.decrease(productId, count);
        return BaseResult.success("减少库存成功！");
    }
}
